package org.springleaf.core.json;

import java.util.Map;

import org.springleaf.utils.Obj2MapUtils;

/**
 * JSON数据
 * @author leaf
 */
public class JsonData implements IJsonObject{
	
	private static final long serialVersionUID = 1L;
	
	/**
	 * 是否成功
	 */
	private boolean isSuccess = false;
	/**
	 * 信息
	 */
	private String msg;
	/**
	 * 结果数据
	 */
	private Object result;

	public JsonData() {
	}

	public JsonData(boolean isSuccess, String msg) {
		this.isSuccess = isSuccess;
		this.msg = msg;
	}

	public JsonData(boolean isSuccess, String msg, Object result) {
		this(isSuccess,msg);
		this.result = result;
	}

	public boolean getIsSuccess() {
		return isSuccess;
	}

	public void setIsSuccess(boolean isSuccess) {
		this.isSuccess = isSuccess;
	}

	public String getMsg() {
		return msg;
	}

	public void setMsg(String msg) {
		this.msg = msg;
	}

	public Object getResult() {
		return result;
	}

	public void setResult(Object result) {
		this.result = result;
	}

	@SuppressWarnings("rawtypes")
	@Override
	public Object toJSonObject() {
		Map map = Obj2MapUtils.toMapExcep(this,new String[]{});
		return map;
	}
}
